export default {
  data: function () {
    return {
      loginForm: {
        username: '',
        password: ''
      },
      tishi: ''
    }
  },
  methods: {
    denglu: function () {
      if (this.loginForm.username === '' || this.loginForm.password === '') {
        this.tishi = '账户密码不能为空'
      } else {
        this.$http.get('/login').then((res) => {
          if (res.data === 1) {
            this.tishi = '登陆成功'
            window.sessionStorage.setItem('token','12345678')
            window.setTimeout(()=>{
              this.$router.push('/home')
            },2000)

          } else {
            this.tishi = '登陆失败'
          }
        })
      }
    },
    chongzhi: function () {
      this.loginForm.username = ''
      this.loginForm.password = ''
      this.tishi = ''
    }

  }

}
